package com.jy.api.vo.admin.workshift;

import com.jy.api.domain.SalesItem;
import com.jy.api.domain.SalesItemDetails;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Created by lihu on 2017/11/25.
 */

@Data
@NoArgsConstructor
@AllArgsConstructor
public class WorkShiftDetailsVo {
    private String id;
    private String storeId;
    private String storeName;

    private Date beginTime;

    private Date endTime;
    /**
     * 开班人id
     */
    //TODO: 修改名称更好反映开班
    private String operatorId;
    /**
     * 开班人名称
     */
    //TODO: 修改名称更好反映开班
    private String operatorName;

    /*
     * 开班人员工 工号
     */
    private String operatorCode;
    /**
     * 交班用户id
     */
    private String closeUserId;
    /**
     * 交班用户名称
     */
    private String closeUsername;
    /**
     * 总销售金额
     */
    private double turnInAmount = 0;
    private double cashAmount = 0;
    private double alipayAmount = 0;
    private double wechatAmount = 0;
    private double alipayCashAmount = 0;
    private double wechatCashAmount = 0;
    private double memberAmount = 0;
    private double ylAmount = 0;
    private String paymentStatics;

    private double couponPrice;
    /**
     * 会员储值金额
     */
    private int memberDepositAmount = 0;
    /**
     * 优惠券金额
     */
    private int couponAmount = 0;
    private double gapAmount;
    private String gapReason;
    /**
     * 是否关班
     */
    private boolean closed = false;

    private int totalQuantity = 0;

    private int totalAmount = 0;

    /**
     * 获取商品分类统计
     */
    private List<SalesItem> items = new ArrayList<>();

    private List<SalesItemDetails> itemDetails = new ArrayList<>();

    /**
     * 员工销售信息
     */
    private List<Staff> staffs = new ArrayList<>();


    private List<MemberDeposit> memberDeposits = new ArrayList<>();


    /**
     * 优惠卷信息
     */
    private List<Coupon> coupons = new ArrayList<>();

    /**
     * 网费支付详情
     */
    private Cost cost;

    private SalesItem.MemberNet net;

    private double memberSalesPrice;


    public void accuracy() {
        turnInAmount = Math.rint(turnInAmount * 100);
        cashAmount = Math.rint(cashAmount * 100);
        alipayAmount = Math.rint(alipayAmount * 100);
        wechatAmount = Math.rint(wechatAmount * 100);
        memberAmount = Math.rint(memberAmount * 100);
        alipayCashAmount = Math.rint(alipayCashAmount * 100);
        wechatCashAmount = Math.rint(wechatCashAmount * 100);
        ylAmount = Math.rint(ylAmount * 100);


    }

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class Cost {


        private int turnInAmount = 0;

        private double cashAmount = 0;

        private int alipayAmount = 0;

        private int wechatAmount = 0;

        private int alipayCashAmount = 0;

        private int wechatCashAmount = 0;

        private int memberAmount = 0;

        private int ylAmount = 0;

        /**
         * 优惠券金额
         */
        private int couponAmount = 0;
    }

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class Coupon {

        private String productId;

        private String productName;

        private int amount;

        private int quantity;

    }


    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class Staff {

        private String code;

        private String creatorId;

        private String creatorName;

        private int orderCount;

        private int totalAmount;

        public Staff(String creatorId, int orderCount, int totalAmount) {
            this.creatorId = creatorId;
            this.orderCount = orderCount;
            this.totalAmount = totalAmount;
        }
    }

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    public static class MemberDeposit {

        private String name;

        private double amount = 0;

        private int qty = 0;


    }

}
